﻿@model DingTalkAgent.Model.RiverSource
@{
    ViewBag.Title = "details";
    Layout = "~/Areas/mobile/Views/Shared/_Layout.cshtml";
}
<style>
    .m-t5 a {
        float:right;
        color:#fff;
        font-weight:bold;
    }
</style>
<div class="dd-header dd-fixed h160">
    @Html.Hidden("leveCode", Model.leveCode)
    @Html.Hidden("RiverSourceType", Model.RiverSourceType)
    @Html.Hidden("pageIndex", 1)
    <div class="dd-fixed-header dd-header-inf dd-bg-blue">
        <h4 class="name">
            <i class="icon iconfont icon-qitaleishuiwenjiance dd-i-yhphoto"></i>
            <span>@Model.resoreName</span>
            @if (Model.remark.Contains("|"))
            {
                <label><i class="icon iconfont icon-yonghutouxiang dd-i-yhphoto"></i>@Model.remark.Split('|')[0]</label>
            }
            else
            {
                <label><i class="icon iconfont icon-yonghutouxiang dd-i-yhphoto"></i></label>
            }

        </h4>
        <div class="m-l20">
            @if (Model.RiverSourceType == "1")
            {
                <span>级别:市级.湖</span>

            }
            @if (Model.RiverSourceType == "2")
            {
                <span>级别:市级.河</span>
            }
            @if (Model.RiverSourceType == "3")
            {
                <span>级别:市级.水库</span>
            }
            @if (Model.RiverSourceType == "4")
            {
                <span>级别:市级.渠道</span>
            }


            <span>所属流域：@Model.ly</span>
        </div>
        <div class="m-t5 ">
            @if (Model.remark.Contains("|"))
            {

                <p class="m-l20">机构:@Model.remark.Split('|')[1] - @Model.remark.Split('|')[2]</p>
                <p class="m-l20">
                    联系方式：联系方式:@Model.remark.Split('|')[3]  <a href="#" onclick="changeData(this)" style="margin-right:15px;">统计</a>
                </p>

            }
            else
            {
                <a href="#" onclick="changeData(this)" style="margin-right:15px;">统计</a>
            }
        </div>
    </div>
    <div class="long-bar">
        <div class="tab-sub-menu dd-menu-bar-w w600">
            <a href="#" class="dd-sub-menu active-sub-tab-menu" onclick="tabchage2('#tabB1')"><span>河长巡查</span></a>
            <a href="#" class="dd-sub-menu" onclick="tabchage2('#tabB2')"><span>保洁汇报</span></a>
            <a href="#" class="dd-sub-menu" onclick="tabchage2('#tabB3')"><span>监督汇报</span></a>
            <a href="#" class="dd-sub-menu" onclick="tabchage2('#tabB4')"><span>违规</span></a>
            <a href="#" class="dd-sub-menu" onclick="tabchage2('#tabB5')"><span>任务</span></a>
        </div>
    </div>
</div>

<div class="dd-container m-t175 dd-box dd-top-line">
    <div class="dd-sub-sub-tab show" id="tabB1">
        <div id="list">
            @Html.Action("list", new { patrolType = 4, riverSourceType = Model.RiverSourceType, leveCode = Model.leveCode })
        </div>
        <div id="listStats"></div>
    </div>
    <div class="dd-sub-sub-tab hidden" id="tabB2">
        <div class="dd-box dd-top-line m-t11 m-b11" style="height:500px;">
            <div class="nodata">
                <img src="~/Skin/nodata.jpg" />
                <div>没有更多数据了~~~</div>

            </div>
        </div>
    </div>
    <div class="dd-sub-sub-tab hidden" id="tabB3">
        <div class="dd-box dd-top-line m-t11 m-b11" style="height:500px;">
            <div class="nodata">
                <img src="~/Skin/nodata.jpg" />
                <div>没有更多数据了~~~</div>

            </div>
        </div>
    </div>
    <div class="dd-sub-sub-tab hidden" id="tabB4">
        <div class="dd-box dd-top-line m-t11 m-b11" style="height:500px;">
            <div class="nodata">
                <img src="~/Skin/nodata.jpg" />
                <div>没有更多数据了~~~</div>

            </div>
        </div>
    </div>
    <div class="dd-sub-sub-tab hidden" id="tabB5">
        <div class="dd-box dd-top-line m-t11 m-b11" style="height:500px;">
            <div class="nodata">
                <img src="~/Skin/nodata.jpg" />
                <div>没有更多数据了~~~</div>

            </div>

        </div>
    </div>
</div>,
<script>

    $(function () {
        $.post("/mobile/login/init", "url=@ViewBag.url&CorpID=ss", function (_config) {
            dd.config({
                agentId: _config.agentId,
                corpId: _config.corpId,
                timeStamp: _config.timeStamp,
                nonceStr: _config.nonceStr,
                signature: _config.signature,
                jsApiList: ['runtime.info', 'device.notification.prompt', 'biz.chat.pickConversation', 'device.notification.confirm',
           'device.notification.alert',
           'device.notification.prompt',
           'biz.chat.open',
           'biz.util.open', 'device.geolocation.get', 'biz.map.locate', 'biz.map.view', 'biz.map.view', 'biz.util.uploadImageFromCamera',
           'biz.user.get',
           'biz.contact.choose',
           'biz.telephone.call',
           'biz.ding.post']
            });

            //dd.ui.pullToRefresh.disable();
            dd.ready(function () {
                dd.biz.navigation.setTitle({
                    title: '玉溪水利',
                    onSuccess: function (data) {
                    },
                    onFail: function (err) {
                        log.e(JSON.stringify(err));
                    }
                });
                //	 alert('dd.ready rocks!');

                dd.runtime.info({
                    onSuccess: function (info) {
                        console.log('runtime info: ' + JSON.stringify(info));
                    },
                    onFail: function (err) {
                        console.log('fail: ' + JSON.stringify(err));
                    }
                });
                dd.ui.pullToRefresh.enable({
                    onSuccess: function () {
                        var page = parseInt($("#pageIndex").val()) + 1;
                        $("#pageIndex").val(page)
                        //判断是否为tab1
                        var tabID = $(".show").attr("id");
                        if (tabID == "tabB1") {
                            $.ajax({
                                type: "POST",
                                url: "list",
                                data: "pageIndex=" + $("#pageIndex").val() + "&riverSourceType=" + $("#riverSourceType").val() + "&leveCode=" + $("#leveCode").val(),
                                success: function (msg) {
                                    dd.ui.pullToRefresh.stop();
                                    $("#list").append(msg);
                                }
                            });
                        } else { dd.ui.pullToRefresh.stop(); }
                    },
                    onFail: function () {
                    }
                });

            });



            dd.error(function (err) {
                alert('dd error: ' + JSON.stringify(err));
            });

        })

    })

    ///重加载时用
    function getloadData() {
        $.ajax({
            type: "POST",
            url: "list",
            data: "pageIndex=" + $("#pageIndex").val() + "&isme=" + $("#isme").val() + "&riverSourceType=" + $("#riverSourceType").val() + "&leveCode=" + $("#leveCode").val(),
            success: function (msg) {
                //  dd.ui.pullToRefresh.stop();
                $("#list").html(msg);
            }
        });
    }

    function showImage(_div, _src) {

        var urls = new Array();
        $(_div).find("img").each(function () {
            urls.push($(this).attr("src"));
        });
        dd.biz.util.previewImage({
            urls: urls,//图片地址列表
            current: _src,//当前显示的图片链接
            onSuccess: function (result) {
                /**/
            },
            onFail: function (err) { }
        })
    }

    ///加载地图
    function loadmap(_longitude, _latitude, _address) {
        dd.biz.map.view({
            latitude: _latitude, // 纬度
            longitude: _longitude, // 经度
            title: _address// 地址/POI名称
        });
    }

    //切换明细与统计
    function changeData(_this) {
        var t = $(_this).html();
        if (t == "明细") {
            $("#listStats").hide();
            $("#list").show();
            $(_this).html("统计");
        }
        else {
            $("#listStats").show();
            $("#list").hide();
            $(_this).html("明细");
            $.ajax({
                type: "POST",
                url: "listStats",
                data: "patrolType=4&leveCode=" + $("#leveCode").val(),
                success: function (msg) {
                    $("#listStats").html(msg);
                }
            });
        }
    }

</script>


<script type="text/javascript">
    $(document).ready(function () {
        $("#tab1").show();
        $("#tab2").hide();
        $(".footer-menu").click(function () {
            $(".footer-menu").removeClass("active-footer-tab");
            $(this).addClass("active-footer-tab");
        });
        $(".dd-menu").click(function () {
            $(".dd-menu").removeClass("active-tab-menu");
            $(this).addClass("active-tab-menu");
        });
        $(".dd-sub-menu").click(function () {
            $(".dd-sub-menu").removeClass("active-sub-tab-menu");
            $(this).addClass("active-sub-tab-menu");
        });
    })
    function tabchage(_id) {
        $(".dd-tab").hide();
        $(_id).show();
    }
    function tabchage1(_id) {
        $(".dd-sub-tab").hide();
        $(_id).show();
    }
    function tabchage2(_id) {
        $(".dd-sub-sub-tab").removeClass("hidden").removeClass("show").addClass("hidden");
        $(_id).removeClass("hidden").addClass("show");
    }
</script>
